﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Screen
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.ComponentModel;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Provides access to display information.</para>
  /// </summary>
  public sealed class Screen
  {
    /// <summary>
    ///   <para>The current width of the screen window in pixels (Read Only).</para>
    /// </summary>
    public static int width => EditorScreen.width;

    /// <summary>
    ///   <para>The current height of the screen window in pixels (Read Only).</para>
    /// </summary>
    public static int height => EditorScreen.height;

    /// <summary>
    ///   <para>The current DPI of the screen / device (Read Only).</para>
    /// </summary>
    public static float dpi => ShimManager.screenShim.dpi;

    /// <summary>
    ///   <para>The current screen resolution (Read Only).</para>
    /// </summary>
    public static Resolution currentResolution => ShimManager.screenShim.currentResolution;

    /// <summary>
    ///   <para>Returns all full-screen resolutions that the monitor supports (Read Only).</para>
    /// </summary>
    public static Resolution[] resolutions => ShimManager.screenShim.resolutions;

    /// <summary>
    ///   <para>Switches the screen resolution.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="fullscreen"></param>
    /// <param name="preferredRefreshRate"></param>
    /// <param name="fullscreenMode"></param>
    public static void SetResolution(
      int width,
      int height,
      FullScreenMode fullscreenMode,
      [UnityEngine.Internal.DefaultValue("0")] int preferredRefreshRate)
    {
      ShimManager.screenShim.SetResolution(width, height, fullscreenMode, preferredRefreshRate);
    }

    /// <summary>
    ///   <para>Switches the screen resolution.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="fullscreen"></param>
    /// <param name="preferredRefreshRate"></param>
    /// <param name="fullscreenMode"></param>
    public static void SetResolution(int width, int height, FullScreenMode fullscreenMode)
    {
      Screen.SetResolution(width, height, fullscreenMode, 0);
    }

    /// <summary>
    ///   <para>Switches the screen resolution.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="fullscreen"></param>
    /// <param name="preferredRefreshRate"></param>
    /// <param name="fullscreenMode"></param>
    public static void SetResolution(
      int width,
      int height,
      bool fullscreen,
      [UnityEngine.Internal.DefaultValue("0")] int preferredRefreshRate)
    {
      Screen.SetResolution(width, height, fullscreen ? FullScreenMode.FullScreenWindow : FullScreenMode.Windowed, preferredRefreshRate);
    }

    /// <summary>
    ///   <para>Switches the screen resolution.</para>
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="fullscreen"></param>
    /// <param name="preferredRefreshRate"></param>
    /// <param name="fullscreenMode"></param>
    public static void SetResolution(int width, int height, bool fullscreen)
    {
      Screen.SetResolution(width, height, fullscreen, 0);
    }

    /// <summary>
    ///   <para>Enables full-screen mode for the application.</para>
    /// </summary>
    public static bool fullScreen
    {
      get => ShimManager.screenShim.fullScreen;
      set => ShimManager.screenShim.fullScreen = value;
    }

    /// <summary>
    ///   <para>Set this property to one of the values in FullScreenMode to change the display mode of your application.</para>
    /// </summary>
    public static FullScreenMode fullScreenMode
    {
      get => ShimManager.screenShim.fullScreenMode;
      set => ShimManager.screenShim.fullScreenMode = value;
    }

    /// <summary>
    ///   <para>Returns the safe area of the screen in pixels (Read Only).</para>
    /// </summary>
    public static Rect safeArea => ShimManager.screenShim.safeArea;

    /// <summary>
    ///   <para>Returns a list of screen areas that are not functional for displaying content (Read Only).</para>
    /// </summary>
    public static Rect[] cutouts => ShimManager.screenShim.cutouts;

    /// <summary>
    ///   <para>Enables auto-rotation to portrait.</para>
    /// </summary>
    public static bool autorotateToPortrait
    {
      get => ShimManager.screenShim.autorotateToPortrait;
      set => ShimManager.screenShim.autorotateToPortrait = value;
    }

    /// <summary>
    ///   <para>Enables auto-rotation to portrait, upside down.</para>
    /// </summary>
    public static bool autorotateToPortraitUpsideDown
    {
      get => ShimManager.screenShim.autorotateToPortraitUpsideDown;
      set => ShimManager.screenShim.autorotateToPortraitUpsideDown = value;
    }

    /// <summary>
    ///   <para>Enables auto-rotation to landscape left.</para>
    /// </summary>
    public static bool autorotateToLandscapeLeft
    {
      get => ShimManager.screenShim.autorotateToLandscapeLeft;
      set => ShimManager.screenShim.autorotateToLandscapeLeft = value;
    }

    /// <summary>
    ///   <para>Enables auto-rotation to landscape right.</para>
    /// </summary>
    public static bool autorotateToLandscapeRight
    {
      get => ShimManager.screenShim.autorotateToLandscapeRight;
      set => ShimManager.screenShim.autorotateToLandscapeRight = value;
    }

    /// <summary>
    ///   <para>Specifies logical orientation of the screen.</para>
    /// </summary>
    public static ScreenOrientation orientation
    {
      get => ShimManager.screenShim.orientation;
      set => ShimManager.screenShim.orientation = value;
    }

    /// <summary>
    ///   <para>A power saving setting, allowing the screen to dim some time after the last active user interaction.</para>
    /// </summary>
    public static int sleepTimeout
    {
      get => ShimManager.screenShim.sleepTimeout;
      set => ShimManager.screenShim.sleepTimeout = value;
    }

    /// <summary>
    ///   <para>Indicates the current brightness of the screen.</para>
    /// </summary>
    public static float brightness
    {
      get => ShimManager.screenShim.brightness;
      set => ShimManager.screenShim.brightness = value;
    }

    /// <summary>
    ///   <para>The position of the top left corner of the main window relative to the top left corner of the display.</para>
    /// </summary>
    public static Vector2Int mainWindowPosition => EditorScreen.mainWindowPosition;

    /// <summary>
    ///   <para>The display information associated with the display that the main application window is on.</para>
    /// </summary>
    public static DisplayInfo mainWindowDisplayInfo => EditorScreen.mainWindowDisplayInfo;

    public static void GetDisplayLayout(List<DisplayInfo> displayLayout)
    {
      EditorScreen.GetDisplayLayout(displayLayout);
    }

    public static AsyncOperation MoveMainWindowTo(in DisplayInfo display, Vector2Int position)
    {
      return EditorScreen.MoveMainWindowTo(in display, position);
    }

    [Obsolete("Property GetResolution has been deprecated. Use resolutions instead (UnityUpgradable) -> resolutions", true)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public static Resolution[] GetResolution => (Resolution[]) null;

    /// <summary>
    ///   <para>Should the cursor be visible?</para>
    /// </summary>
    [Obsolete("Property showCursor has been deprecated. Use Cursor.visible instead (UnityUpgradable) -> UnityEngine.Cursor.visible", true)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public static bool showCursor { get; set; }

    /// <summary>
    ///   <para>Enable cursor locking</para>
    /// </summary>
    [Obsolete("Use Cursor.lockState and Cursor.visible instead.", false)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public static bool lockCursor
    {
      get => CursorLockMode.Locked == Cursor.lockState;
      set
      {
        if (value)
        {
          Cursor.visible = false;
          Cursor.lockState = CursorLockMode.Locked;
        }
        else
        {
          Cursor.lockState = CursorLockMode.None;
          Cursor.visible = true;
        }
      }
    }
  }
}
